home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / MELL / NETLIB00 / !NetLib / sys / h / byteorder next >
Encoding:
Text File  |  1997-04-20  |  815 b   |  41 lines

  1. #ifndef __sys_byteorder_h
  2. #define __sys_byteorder_h
  3.  
  4. /* Freenet programmers library - sys/byteorder.h - 23/5/95 */
  5.  
  6. #ifndef __ENDIAN_H
  7. /*
  8.  * Byte order definitions
  9.  */
  10. #define LITTLE_ENDIAN 1234 /* Arcs, Vaxen, Motorola chips */
  11. #define BIG_ENDIAN    4321 /* Intel chips, Net byte order */
  12. #define PDP_ENDIAN    3412 /* DEC PDP machines */
  13.  
  14. /*
  15.  * Acorn machines use the ARM in little endian form
  16.  */
  17. #define BYTE_ORDER    LITTLE_ENDIAN
  18. #endif
  19.  
  20. /*
  21.  * Convert a 32 bit word from host to net byte order
  22.  */
  23. extern u_long htonl(u_long);
  24.  
  25. /*
  26.  * Convert a 32 bit word from net to host byte order
  27.  */
  28. extern u_long ntohl(u_long);
  29.  
  30. /*
  31.  * Convert a 16 bit word from host to net byte order
  32.  */
  33. extern u_short htons(u_short);
  34.  
  35. /*
  36.  * Convert a 16 bit word from net to host byte order
  37.  */
  38. extern u_short ntohs(u_short);
  39.  
  40. #endif
  41.